/*
 * Amazon Ads API - Sponsored Products
 * Use the Amazon Ads API for Sponsored Products for campaign, ad group, keyword, negative keyword, and product ad management operations. For more information about Sponsored Products, see the [Sponsored Products Support Center](https://advertising.amazon.com/help?entityId=ENTITY3CWETCZD9HEG2#GWGFKPEWVWG2CLUJ). For onboarding information, see the [account setup](setting-up/account-setup) topic.<br/><br/> 
 *
 * The version of the OpenAPI document: 2.0
 * 
 *
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 * https://openapi-generator.tech
 * Do not edit the class manually.
 */


package org.openapitools.client.api;

import org.openapitools.client.ApiCallback;
import org.openapitools.client.ApiClient;
import org.openapitools.client.ApiException;
import org.openapitools.client.ApiResponse;
import org.openapitools.client.Configuration;
import org.openapitools.client.Pair;
import org.openapitools.client.ProgressRequestBody;
import org.openapitools.client.ProgressResponseBody;

import com.google.gson.reflect.TypeToken;

import java.io.IOException;


import java.math.BigDecimal;
import org.openapitools.client.model.CreateNegativeTargetingClause;
import org.openapitools.client.model.Error;
import org.openapitools.client.model.NegativeTargetingClause;
import org.openapitools.client.model.NegativeTargetingClauseEx;
import org.openapitools.client.model.NegativeTargetingClauseResponse;
import org.openapitools.client.model.UpdateNegativeTargetingClause;

import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class NegativeProductTargetingApi {
    private ApiClient localVarApiClient;

    public NegativeProductTargetingApi() {
        this(Configuration.getDefaultApiClient());
    }

    public NegativeProductTargetingApi(ApiClient apiClient) {
        this.localVarApiClient = apiClient;
    }

    public ApiClient getApiClient() {
        return localVarApiClient;
    }

    public void setApiClient(ApiClient apiClient) {
        this.localVarApiClient = apiClient;
    }

    /**
     * Build call for archiveNegativeTargetingClause
     * @param amazonAdvertisingAPIClientId The identifier of a client associated with a \&quot;Login with Amazon\&quot; developer account. (required)
     * @param amazonAdvertisingAPIScope The identifier of a profile associated with the advertiser account. Use &#x60;GET&#x60; method on Profiles resource to list profiles associated with the access token passed in the HTTP Authorization header. (required)
     * @param targetId The target identifier. (required)
     * @param _callback Callback for upload/download progress
     * @return Call to execute
     * @throws ApiException If fail to serialize the request body object
     * @http.response.details
     <table summary="Response Details" border="1">
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> Success. </td><td>  -  </td></tr>
        <tr><td> 401 </td><td> Unauthorized. </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call archiveNegativeTargetingClauseCall(String amazonAdvertisingAPIClientId, String amazonAdvertisingAPIScope, BigDecimal targetId, final ApiCallback _callback) throws ApiException {
        Object localVarPostBody = null;

        // create path and map variables
        String localVarPath = "/v2/sp/negativeTargets/{targetId}"
            .replaceAll("\\{" + "targetId" + "\\}", localVarApiClient.escapeString(targetId.toString()));

        List<Pair> localVarQueryParams = new ArrayList<Pair>();
        List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
        Map<String, String> localVarHeaderParams = new HashMap<String, String>();
        Map<String, String> localVarCookieParams = new HashMap<String, String>();
        Map<String, Object> localVarFormParams = new HashMap<String, Object>();

        if (amazonAdvertisingAPIClientId != null) {
            localVarHeaderParams.put("Amazon-Advertising-API-ClientId", localVarApiClient.parameterToString(amazonAdvertisingAPIClientId));
        }

        if (amazonAdvertisingAPIScope != null) {
            localVarHeaderParams.put("Amazon-Advertising-API-Scope", localVarApiClient.parameterToString(amazonAdvertisingAPIScope));
        }

        final String[] localVarAccepts = {
            "application/json"
        };
        final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts);
        if (localVarAccept != null) {
            localVarHeaderParams.put("Accept", localVarAccept);
        }

        final String[] localVarContentTypes = {
            
        };
        final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
        localVarHeaderParams.put("Content-Type", localVarContentType);

        String[] localVarAuthNames = new String[] { "bearer" };
        return localVarApiClient.buildCall(localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback);
    }

    @SuppressWarnings("rawtypes")
    private okhttp3.Call archiveNegativeTargetingClauseValidateBeforeCall(String amazonAdvertisingAPIClientId, String amazonAdvertisingAPIScope, BigDecimal targetId, final ApiCallback _callback) throws ApiException {
        
        // verify the required parameter 'amazonAdvertisingAPIClientId' is set
        if (amazonAdvertisingAPIClientId == null) {
            throw new ApiException("Missing the required parameter 'amazonAdvertisingAPIClientId' when calling archiveNegativeTargetingClause(Async)");
        }
        
        // verify the required parameter 'amazonAdvertisingAPIScope' is set
        if (amazonAdvertisingAPIScope == null) {
            throw new ApiException("Missing the required parameter 'amazonAdvertisingAPIScope' when calling archiveNegativeTargetingClause(Async)");
        }
        
        // verify the required parameter 'targetId' is set
        if (targetId == null) {
            throw new ApiException("Missing the required parameter 'targetId' when calling archiveNegativeTargetingClause(Async)");
        }
        

        okhttp3.Call localVarCall = archiveNegativeTargetingClauseCall(amazonAdvertisingAPIClientId, amazonAdvertisingAPIScope, targetId, _callback);
        return localVarCall;

    }

    /**
     * Archives a negative targeting clause.
     * Set the &#x60;status&#x60; of a negative targeting clause to &#x60;archived&#x60;. Note that once a negative targeting clause &#x60;status&#x60; is set to &#x60;archived&#x60;, it cannot be changed.
     * @param amazonAdvertisingAPIClientId The identifier of a client associated with a \&quot;Login with Amazon\&quot; developer account. (required)
     * @param amazonAdvertisingAPIScope The identifier of a profile associated with the advertiser account. Use &#x60;GET&#x60; method on Profiles resource to list profiles associated with the access token passed in the HTTP Authorization header. (required)
     * @param targetId The target identifier. (required)
     * @return NegativeTargetingClauseResponse
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     * @http.response.details
     <table summary="Response Details" border="1">
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> Success. </td><td>  -  </td></tr>
        <tr><td> 401 </td><td> Unauthorized. </td><td>  -  </td></tr>
     </table>
     */
    public NegativeTargetingClauseResponse archiveNegativeTargetingClause(String amazonAdvertisingAPIClientId, String amazonAdvertisingAPIScope, BigDecimal targetId) throws ApiException {
        ApiResponse<NegativeTargetingClauseResponse> localVarResp = archiveNegativeTargetingClauseWithHttpInfo(amazonAdvertisingAPIClientId, amazonAdvertisingAPIScope, targetId);
        return localVarResp.getData();
    }

    /**
     * Archives a negative targeting clause.
     * Set the &#x60;status&#x60; of a negative targeting clause to &#x60;archived&#x60;. Note that once a negative targeting clause &#x60;status&#x60; is set to &#x60;archived&#x60;, it cannot be changed.
     * @param amazonAdvertisingAPIClientId The identifier of a client associated with a \&quot;Login with Amazon\&quot; developer account. (required)
     * @param amazonAdvertisingAPIScope The identifier of a profile associated with the advertiser account. Use &#x60;GET&#x60; method on Profiles resource to list profiles associated with the access token passed in the HTTP Authorization header. (required)
     * @param targetId The target identifier. (required)
     * @return ApiResponse&lt;NegativeTargetingClauseResponse&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     * @http.response.details
     <table summary="Response Details" border="1">
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> Success. </td><td>  -  </td></tr>
        <tr><td> 401 </td><td> Unauthorized. </td><td>  -  </td></tr>
     </table>
     */
    public ApiResponse<NegativeTargetingClauseResponse> archiveNegativeTargetingClauseWithHttpInfo(String amazonAdvertisingAPIClientId, String amazonAdvertisingAPIScope, BigDecimal targetId) throws ApiException {
        okhttp3.Call localVarCall = archiveNegativeTargetingClauseValidateBeforeCall(amazonAdvertisingAPIClientId, amazonAdvertisingAPIScope, targetId, null);
        Type localVarReturnType = new TypeToken<NegativeTargetingClauseResponse>(){}.getType();
        return localVarApiClient.execute(localVarCall, localVarReturnType);
    }

    /**
     * Archives a negative targeting clause. (asynchronously)
     * Set the &#x60;status&#x60; of a negative targeting clause to &#x60;archived&#x60;. Note that once a negative targeting clause &#x60;status&#x60; is set to &#x60;archived&#x60;, it cannot be changed.
     * @param amazonAdvertisingAPIClientId The identifier of a client associated with a \&quot;Login with Amazon\&quot; developer account. (required)
     * @param amazonAdvertisingAPIScope The identifier of a profile associated with the advertiser account. Use &#x60;GET&#x60; method on Profiles resource to list profiles associated with the access token passed in the HTTP Authorization header. (required)
     * @param targetId The target identifier. (required)
     * @param _callback The callback to be executed when the API call finishes
     * @return The request call
     * @throws ApiException If fail to process the API call, e.g. serializing the request body object
     * @http.response.details
     <table summary="Response Details" border="1">
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> Success. </td><td>  -  </td></tr>
        <tr><td> 401 </td><td> Unauthorized. </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call archiveNegativeTargetingClauseAsync(String amazonAdvertisingAPIClientId, String amazonAdvertisingAPIScope, BigDecimal targetId, final ApiCallback<NegativeTargetingClauseResponse> _callback) throws ApiException {

        okhttp3.Call localVarCall = archiveNegativeTargetingClauseValidateBeforeCall(amazonAdvertisingAPIClientId, amazonAdvertisingAPIScope, targetId, _callback);
        Type localVarReturnType = new TypeToken<NegativeTargetingClauseResponse>(){}.getType();
        localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
        return localVarCall;
    }
    /**
     * Build call for createNegativeTargetingClauses
     * @param amazonAdvertisingAPIClientId The identifier of a client associated with a \&quot;Login with Amazon\&quot; developer account. (required)
     * @param amazonAdvertisingAPIScope The identifier of a profile associated with the advertiser account. Use &#x60;GET&#x60; method on Profiles resource to list profiles associated with the access token passed in the HTTP Authorization header. (required)
     * @param createNegativeTargetingClause A list of negative targeting clauses. (optional)
     * @param _callback Callback for upload/download progress
     * @return Call to execute
     * @throws ApiException If fail to serialize the request body object
     * @http.response.details
     <table summary="Response Details" border="1">
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 207 </td><td> Multi-status. </td><td>  -  </td></tr>
        <tr><td> 401 </td><td> Unauthorized. </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call createNegativeTargetingClausesCall(String amazonAdvertisingAPIClientId, String amazonAdvertisingAPIScope, List<CreateNegativeTargetingClause> createNegativeTargetingClause, final ApiCallback _callback) throws ApiException {
        Object localVarPostBody = createNegativeTargetingClause;

        // create path and map variables
        String localVarPath = "/v2/sp/negativeTargets";

        List<Pair> localVarQueryParams = new ArrayList<Pair>();
        List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
        Map<String, String> localVarHeaderParams = new HashMap<String, String>();
        Map<String, String> localVarCookieParams = new HashMap<String, String>();
        Map<String, Object> localVarFormParams = new HashMap<String, Object>();

        if (amazonAdvertisingAPIClientId != null) {
            localVarHeaderParams.put("Amazon-Advertising-API-ClientId", localVarApiClient.parameterToString(amazonAdvertisingAPIClientId));
        }

        if (amazonAdvertisingAPIScope != null) {
            localVarHeaderParams.put("Amazon-Advertising-API-Scope", localVarApiClient.parameterToString(amazonAdvertisingAPIScope));
        }

        final String[] localVarAccepts = {
            "application/json"
        };
        final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts);
        if (localVarAccept != null) {
            localVarHeaderParams.put("Accept", localVarAccept);
        }

        final String[] localVarContentTypes = {
            "application/json"
        };
        final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
        localVarHeaderParams.put("Content-Type", localVarContentType);

        String[] localVarAuthNames = new String[] { "bearer" };
        return localVarApiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback);
    }

    @SuppressWarnings("rawtypes")
    private okhttp3.Call createNegativeTargetingClausesValidateBeforeCall(String amazonAdvertisingAPIClientId, String amazonAdvertisingAPIScope, List<CreateNegativeTargetingClause> createNegativeTargetingClause, final ApiCallback _callback) throws ApiException {
        
        // verify the required parameter 'amazonAdvertisingAPIClientId' is set
        if (amazonAdvertisingAPIClientId == null) {
            throw new ApiException("Missing the required parameter 'amazonAdvertisingAPIClientId' when calling createNegativeTargetingClauses(Async)");
        }
        
        // verify the required parameter 'amazonAdvertisingAPIScope' is set
        if (amazonAdvertisingAPIScope == null) {
            throw new ApiException("Missing the required parameter 'amazonAdvertisingAPIScope' when calling createNegativeTargetingClauses(Async)");
        }
        

        okhttp3.Call localVarCall = createNegativeTargetingClausesCall(amazonAdvertisingAPIClientId, amazonAdvertisingAPIScope, createNegativeTargetingClause, _callback);
        return localVarCall;

    }

    /**
     * Creates one ore more negative targeting expressions.
     * 
     * @param amazonAdvertisingAPIClientId The identifier of a client associated with a \&quot;Login with Amazon\&quot; developer account. (required)
     * @param amazonAdvertisingAPIScope The identifier of a profile associated with the advertiser account. Use &#x60;GET&#x60; method on Profiles resource to list profiles associated with the access token passed in the HTTP Authorization header. (required)
     * @param createNegativeTargetingClause A list of negative targeting clauses. (optional)
     * @return List&lt;NegativeTargetingClauseResponse&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     * @http.response.details
     <table summary="Response Details" border="1">
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 207 </td><td> Multi-status. </td><td>  -  </td></tr>
        <tr><td> 401 </td><td> Unauthorized. </td><td>  -  </td></tr>
     </table>
     */
    public List<NegativeTargetingClauseResponse> createNegativeTargetingClauses(String amazonAdvertisingAPIClientId, String amazonAdvertisingAPIScope, List<CreateNegativeTargetingClause> createNegativeTargetingClause) throws ApiException {
        ApiResponse<List<NegativeTargetingClauseResponse>> localVarResp = createNegativeTargetingClausesWithHttpInfo(amazonAdvertisingAPIClientId, amazonAdvertisingAPIScope, createNegativeTargetingClause);
        return localVarResp.getData();
    }

    /**
     * Creates one ore more negative targeting expressions.
     * 
     * @param amazonAdvertisingAPIClientId The identifier of a client associated with a \&quot;Login with Amazon\&quot; developer account. (required)
     * @param amazonAdvertisingAPIScope The identifier of a profile associated with the advertiser account. Use &#x60;GET&#x60; method on Profiles resource to list profiles associated with the access token passed in the HTTP Authorization header. (required)
     * @param createNegativeTargetingClause A list of negative targeting clauses. (optional)
     * @return ApiResponse&lt;List&lt;NegativeTargetingClauseResponse&gt;&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     * @http.response.details
     <table summary="Response Details" border="1">
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 207 </td><td> Multi-status. </td><td>  -  </td></tr>
        <tr><td> 401 </td><td> Unauthorized. </td><td>  -  </td></tr>
     </table>
     */
    public ApiResponse<List<NegativeTargetingClauseResponse>> createNegativeTargetingClausesWithHttpInfo(String amazonAdvertisingAPIClientId, String amazonAdvertisingAPIScope, List<CreateNegativeTargetingClause> createNegativeTargetingClause) throws ApiException {
        okhttp3.Call localVarCall = createNegativeTargetingClausesValidateBeforeCall(amazonAdvertisingAPIClientId, amazonAdvertisingAPIScope, createNegativeTargetingClause, null);
        Type localVarReturnType = new TypeToken<List<NegativeTargetingClauseResponse>>(){}.getType();
        return localVarApiClient.execute(localVarCall, localVarReturnType);
    }

    /**
     * Creates one ore more negative targeting expressions. (asynchronously)
     * 
     * @param amazonAdvertisingAPIClientId The identifier of a client associated with a \&quot;Login with Amazon\&quot; developer account. (required)
     * @param amazonAdvertisingAPIScope The identifier of a profile associated with the advertiser account. Use &#x60;GET&#x60; method on Profiles resource to list profiles associated with the access token passed in the HTTP Authorization header. (required)
     * @param createNegativeTargetingClause A list of negative targeting clauses. (optional)
     * @param _callback The callback to be executed when the API call finishes
     * @return The request call
     * @throws ApiException If fail to process the API call, e.g. serializing the request body object
     * @http.response.details
     <table summary="Response Details" border="1">
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 207 </td><td> Multi-status. </td><td>  -  </td></tr>
        <tr><td> 401 </td><td> Unauthorized. </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call createNegativeTargetingClausesAsync(String amazonAdvertisingAPIClientId, String amazonAdvertisingAPIScope, List<CreateNegativeTargetingClause> createNegativeTargetingClause, final ApiCallback<List<NegativeTargetingClauseResponse>> _callback) throws ApiException {

        okhttp3.Call localVarCall = createNegativeTargetingClausesValidateBeforeCall(amazonAdvertisingAPIClientId, amazonAdvertisingAPIScope, createNegativeTargetingClause, _callback);
        Type localVarReturnType = new TypeToken<List<NegativeTargetingClauseResponse>>(){}.getType();
        localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
        return localVarCall;
    }
    /**
     * Build call for getNegativeTargetingClause
     * @param amazonAdvertisingAPIClientId The identifier of a client associated with a \&quot;Login with Amazon\&quot; developer account. (required)
     * @param amazonAdvertisingAPIScope The identifier of a profile associated with the advertiser account. Use &#x60;GET&#x60; method on Profiles resource to list profiles associated with the access token passed in the HTTP Authorization header. (required)
     * @param targetId The target identifier. (required)
     * @param _callback Callback for upload/download progress
     * @return Call to execute
     * @throws ApiException If fail to serialize the request body object
     * @http.response.details
     <table summary="Response Details" border="1">
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> Success. </td><td>  -  </td></tr>
        <tr><td> 401 </td><td> Unauthorized. </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call getNegativeTargetingClauseCall(String amazonAdvertisingAPIClientId, String amazonAdvertisingAPIScope, BigDecimal targetId, final ApiCallback _callback) throws ApiException {
        Object localVarPostBody = null;

        // create path and map variables
        String localVarPath = "/v2/sp/negativeTargets/{targetId}"
            .replaceAll("\\{" + "targetId" + "\\}", localVarApiClient.escapeString(targetId.toString()));

        List<Pair> localVarQueryParams = new ArrayList<Pair>();
        List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
        Map<String, String> localVarHeaderParams = new HashMap<String, String>();
        Map<String, String> localVarCookieParams = new HashMap<String, String>();
        Map<String, Object> localVarFormParams = new HashMap<String, Object>();

        if (amazonAdvertisingAPIClientId != null) {
            localVarHeaderParams.put("Amazon-Advertising-API-ClientId", localVarApiClient.parameterToString(amazonAdvertisingAPIClientId));
        }

        if (amazonAdvertisingAPIScope != null) {
            localVarHeaderParams.put("Amazon-Advertising-API-Scope", localVarApiClient.parameterToString(amazonAdvertisingAPIScope));
        }

        final String[] localVarAccepts = {
            "application/json"
        };
        final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts);
        if (localVarAccept != null) {
            localVarHeaderParams.put("Accept", localVarAccept);
        }

        final String[] localVarContentTypes = {
            
        };
        final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
        localVarHeaderParams.put("Content-Type", localVarContentType);

        String[] localVarAuthNames = new String[] { "bearer" };
        return localVarApiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback);
    }

    @SuppressWarnings("rawtypes")
    private okhttp3.Call getNegativeTargetingClauseValidateBeforeCall(String amazonAdvertisingAPIClientId, String amazonAdvertisingAPIScope, BigDecimal targetId, final ApiCallback _callback) throws ApiException {
        
        // verify the required parameter 'amazonAdvertisingAPIClientId' is set
        if (amazonAdvertisingAPIClientId == null) {
            throw new ApiException("Missing the required parameter 'amazonAdvertisingAPIClientId' when calling getNegativeTargetingClause(Async)");
        }
        
        // verify the required parameter 'amazonAdvertisingAPIScope' is set
        if (amazonAdvertisingAPIScope == null) {
            throw new ApiException("Missing the required parameter 'amazonAdvertisingAPIScope' when calling getNegativeTargetingClause(Async)");
        }
        
        // verify the required parameter 'targetId' is set
        if (targetId == null) {
            throw new ApiException("Missing the required parameter 'targetId' when calling getNegativeTargetingClause(Async)");
        }
        

        okhttp3.Call localVarCall = getNegativeTargetingClauseCall(amazonAdvertisingAPIClientId, amazonAdvertisingAPIScope, targetId, _callback);
        return localVarCall;

    }

    /**
     * Get a negative targeting clause specified by identifier.
     * 
     * @param amazonAdvertisingAPIClientId The identifier of a client associated with a \&quot;Login with Amazon\&quot; developer account. (required)
     * @param amazonAdvertisingAPIScope The identifier of a profile associated with the advertiser account. Use &#x60;GET&#x60; method on Profiles resource to list profiles associated with the access token passed in the HTTP Authorization header. (required)
     * @param targetId The target identifier. (required)
     * @return NegativeTargetingClause
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     * @http.response.details
     <table summary="Response Details" border="1">
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> Success. </td><td>  -  </td></tr>
        <tr><td> 401 </td><td> Unauthorized. </td><td>  -  </td></tr>
     </table>
     */
    public NegativeTargetingClause getNegativeTargetingClause(String amazonAdvertisingAPIClientId, String amazonAdvertisingAPIScope, BigDecimal targetId) throws ApiException {
        ApiResponse<NegativeTargetingClause> localVarResp = getNegativeTargetingClauseWithHttpInfo(amazonAdvertisingAPIClientId, amazonAdvertisingAPIScope, targetId);
        return localVarResp.getData();
    }

    /**
     * Get a negative targeting clause specified by identifier.
     * 
     * @param amazonAdvertisingAPIClientId The identifier of a client associated with a \&quot;Login with Amazon\&quot; developer account. (required)
     * @param amazonAdvertisingAPIScope The identifier of a profile associated with the advertiser account. Use &#x60;GET&#x60; method on Profiles resource to list profiles associated with the access token passed in the HTTP Authorization header. (required)
     * @param targetId The target identifier. (required)
     * @return ApiResponse&lt;NegativeTargetingClause&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     * @http.response.details
     <table summary="Response Details" border="1">
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> Success. </td><td>  -  </td></tr>
        <tr><td> 401 </td><td> Unauthorized. </td><td>  -  </td></tr>
     </table>
     */
    public ApiResponse<NegativeTargetingClause> getNegativeTargetingClauseWithHttpInfo(String amazonAdvertisingAPIClientId, String amazonAdvertisingAPIScope, BigDecimal targetId) throws ApiException {
        okhttp3.Call localVarCall = getNegativeTargetingClauseValidateBeforeCall(amazonAdvertisingAPIClientId, amazonAdvertisingAPIScope, targetId, null);
        Type localVarReturnType = new TypeToken<NegativeTargetingClause>(){}.getType();
        return localVarApiClient.execute(localVarCall, localVarReturnType);
    }

    /**
     * Get a negative targeting clause specified by identifier. (asynchronously)
     * 
     * @param amazonAdvertisingAPIClientId The identifier of a client associated with a \&quot;Login with Amazon\&quot; developer account. (required)
     * @param amazonAdvertisingAPIScope The identifier of a profile associated with the advertiser account. Use &#x60;GET&#x60; method on Profiles resource to list profiles associated with the access token passed in the HTTP Authorization header. (required)
     * @param targetId The target identifier. (required)
     * @param _callback The callback to be executed when the API call finishes
     * @return The request call
     * @throws ApiException If fail to process the API call, e.g. serializing the request body object
     * @http.response.details
     <table summary="Response Details" border="1">
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> Success. </td><td>  -  </td></tr>
        <tr><td> 401 </td><td> Unauthorized. </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call getNegativeTargetingClauseAsync(String amazonAdvertisingAPIClientId, String amazonAdvertisingAPIScope, BigDecimal targetId, final ApiCallback<NegativeTargetingClause> _callback) throws ApiException {

        okhttp3.Call localVarCall = getNegativeTargetingClauseValidateBeforeCall(amazonAdvertisingAPIClientId, amazonAdvertisingAPIScope, targetId, _callback);
        Type localVarReturnType = new TypeToken<NegativeTargetingClause>(){}.getType();
        localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
        return localVarCall;
    }
    /**
     * Build call for getNegativeTargetingClauseEx
     * @param amazonAdvertisingAPIClientId The identifier of a client associated with a \&quot;Login with Amazon\&quot; developer account. (required)
     * @param amazonAdvertisingAPIScope The identifier of a profile associated with the advertiser account. Use &#x60;GET&#x60; method on Profiles resource to list profiles associated with the access token passed in the HTTP Authorization header. (required)
     * @param targetId The target identifier. (required)
     * @param _callback Callback for upload/download progress
     * @return Call to execute
     * @throws ApiException If fail to serialize the request body object
     * @http.response.details
     <table summary="Response Details" border="1">
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> Success. </td><td>  -  </td></tr>
        <tr><td> 404 </td><td> The requested resource was not found. </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call getNegativeTargetingClauseExCall(String amazonAdvertisingAPIClientId, String amazonAdvertisingAPIScope, BigDecimal targetId, final ApiCallback _callback) throws ApiException {
        Object localVarPostBody = null;

        // create path and map variables
        String localVarPath = "/v2/sp/negativeTargets/extended/{targetId}"
            .replaceAll("\\{" + "targetId" + "\\}", localVarApiClient.escapeString(targetId.toString()));

        List<Pair> localVarQueryParams = new ArrayList<Pair>();
        List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
        Map<String, String> localVarHeaderParams = new HashMap<String, String>();
        Map<String, String> localVarCookieParams = new HashMap<String, String>();
        Map<String, Object> localVarFormParams = new HashMap<String, Object>();

        if (amazonAdvertisingAPIClientId != null) {
            localVarHeaderParams.put("Amazon-Advertising-API-ClientId", localVarApiClient.parameterToString(amazonAdvertisingAPIClientId));
        }

        if (amazonAdvertisingAPIScope != null) {
            localVarHeaderParams.put("Amazon-Advertising-API-Scope", localVarApiClient.parameterToString(amazonAdvertisingAPIScope));
        }

        final String[] localVarAccepts = {
            "application/json"
        };
        final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts);
        if (localVarAccept != null) {
            localVarHeaderParams.put("Accept", localVarAccept);
        }

        final String[] localVarContentTypes = {
            
        };
        final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
        localVarHeaderParams.put("Content-Type", localVarContentType);

        String[] localVarAuthNames = new String[] { "bearer" };
        return localVarApiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback);
    }

    @SuppressWarnings("rawtypes")
    private okhttp3.Call getNegativeTargetingClauseExValidateBeforeCall(String amazonAdvertisingAPIClientId, String amazonAdvertisingAPIScope, BigDecimal targetId, final ApiCallback _callback) throws ApiException {
        
        // verify the required parameter 'amazonAdvertisingAPIClientId' is set
        if (amazonAdvertisingAPIClientId == null) {
            throw new ApiException("Missing the required parameter 'amazonAdvertisingAPIClientId' when calling getNegativeTargetingClauseEx(Async)");
        }
        
        // verify the required parameter 'amazonAdvertisingAPIScope' is set
        if (amazonAdvertisingAPIScope == null) {
            throw new ApiException("Missing the required parameter 'amazonAdvertisingAPIScope' when calling getNegativeTargetingClauseEx(Async)");
        }
        
        // verify the required parameter 'targetId' is set
        if (targetId == null) {
            throw new ApiException("Missing the required parameter 'targetId' when calling getNegativeTargetingClauseEx(Async)");
        }
        

        okhttp3.Call localVarCall = getNegativeTargetingClauseExCall(amazonAdvertisingAPIClientId, amazonAdvertisingAPIScope, targetId, _callback);
        return localVarCall;

    }

    /**
     * Get a negative targeting clause specified by identifier.
     * 
     * @param amazonAdvertisingAPIClientId The identifier of a client associated with a \&quot;Login with Amazon\&quot; developer account. (required)
     * @param amazonAdvertisingAPIScope The identifier of a profile associated with the advertiser account. Use &#x60;GET&#x60; method on Profiles resource to list profiles associated with the access token passed in the HTTP Authorization header. (required)
     * @param targetId The target identifier. (required)
     * @return NegativeTargetingClauseEx
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     * @http.response.details
     <table summary="Response Details" border="1">
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> Success. </td><td>  -  </td></tr>
        <tr><td> 404 </td><td> The requested resource was not found. </td><td>  -  </td></tr>
     </table>
     */
    public NegativeTargetingClauseEx getNegativeTargetingClauseEx(String amazonAdvertisingAPIClientId, String amazonAdvertisingAPIScope, BigDecimal targetId) throws ApiException {
        ApiResponse<NegativeTargetingClauseEx> localVarResp = getNegativeTargetingClauseExWithHttpInfo(amazonAdvertisingAPIClientId, amazonAdvertisingAPIScope, targetId);
        return localVarResp.getData();
    }

    /**
     * Get a negative targeting clause specified by identifier.
     * 
     * @param amazonAdvertisingAPIClientId The identifier of a client associated with a \&quot;Login with Amazon\&quot; developer account. (required)
     * @param amazonAdvertisingAPIScope The identifier of a profile associated with the advertiser account. Use &#x60;GET&#x60; method on Profiles resource to list profiles associated with the access token passed in the HTTP Authorization header. (required)
     * @param targetId The target identifier. (required)
     * @return ApiResponse&lt;NegativeTargetingClauseEx&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     * @http.response.details
     <table summary="Response Details" border="1">
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> Success. </td><td>  -  </td></tr>
        <tr><td> 404 </td><td> The requested resource was not found. </td><td>  -  </td></tr>
     </table>
     */
    public ApiResponse<NegativeTargetingClauseEx> getNegativeTargetingClauseExWithHttpInfo(String amazonAdvertisingAPIClientId, String amazonAdvertisingAPIScope, BigDecimal targetId) throws ApiException {
        okhttp3.Call localVarCall = getNegativeTargetingClauseExValidateBeforeCall(amazonAdvertisingAPIClientId, amazonAdvertisingAPIScope, targetId, null);
        Type localVarReturnType = new TypeToken<NegativeTargetingClauseEx>(){}.getType();
        return localVarApiClient.execute(localVarCall, localVarReturnType);
    }

    /**
     * Get a negative targeting clause specified by identifier. (asynchronously)
     * 
     * @param amazonAdvertisingAPIClientId The identifier of a client associated with a \&quot;Login with Amazon\&quot; developer account. (required)
     * @param amazonAdvertisingAPIScope The identifier of a profile associated with the advertiser account. Use &#x60;GET&#x60; method on Profiles resource to list profiles associated with the access token passed in the HTTP Authorization header. (required)
     * @param targetId The target identifier. (required)
     * @param _callback The callback to be executed when the API call finishes
     * @return The request call
     * @throws ApiException If fail to process the API call, e.g. serializing the request body object
     * @http.response.details
     <table summary="Response Details" border="1">
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> Success. </td><td>  -  </td></tr>
        <tr><td> 404 </td><td> The requested resource was not found. </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call getNegativeTargetingClauseExAsync(String amazonAdvertisingAPIClientId, String amazonAdvertisingAPIScope, BigDecimal targetId, final ApiCallback<NegativeTargetingClauseEx> _callback) throws ApiException {

        okhttp3.Call localVarCall = getNegativeTargetingClauseExValidateBeforeCall(amazonAdvertisingAPIClientId, amazonAdvertisingAPIScope, targetId, _callback);
        Type localVarReturnType = new TypeToken<NegativeTargetingClauseEx>(){}.getType();
        localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
        return localVarCall;
    }
    /**
     * Build call for listNegativeTargetingClauses
     * @param amazonAdvertisingAPIClientId The identifier of a client associated with a \&quot;Login with Amazon\&quot; developer account. (required)
     * @param amazonAdvertisingAPIScope The identifier of a profile associated with the advertiser account. Use &#x60;GET&#x60; method on Profiles resource to list profiles associated with the access token passed in the HTTP Authorization header. (required)
     * @param startIndex 0-indexed record offset for the result set. (optional, default to 0)
     * @param count Number of records to include in the paged response. Defaults to max page size. (optional)
     * @param stateFilter Restricts results to negative resources with state within the specified comma-separated list. Default includes all. (optional)
     * @param campaignIdFilter A comma-delimited list of campaign identifiers. (optional)
     * @param adGroupIdFilter Restricts results to keywords associated with ad groups specified by identifier in the comma-delimited list. (optional)
     * @param targetIdFilter A comma-delimited list of target identifiers. (optional)
     * @param _callback Callback for upload/download progress
     * @return Call to execute
     * @throws ApiException If fail to serialize the request body object
     * @http.response.details
     <table summary="Response Details" border="1">
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> Success. </td><td>  -  </td></tr>
        <tr><td> 404 </td><td> The requested resource was not found. </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call listNegativeTargetingClausesCall(String amazonAdvertisingAPIClientId, String amazonAdvertisingAPIScope, BigDecimal startIndex, BigDecimal count, String stateFilter, String campaignIdFilter, String adGroupIdFilter, String targetIdFilter, final ApiCallback _callback) throws ApiException {
        Object localVarPostBody = null;

        // create path and map variables
        String localVarPath = "/v2/sp/negativeTargets";

        List<Pair> localVarQueryParams = new ArrayList<Pair>();
        List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
        Map<String, String> localVarHeaderParams = new HashMap<String, String>();
        Map<String, String> localVarCookieParams = new HashMap<String, String>();
        Map<String, Object> localVarFormParams = new HashMap<String, Object>();

        if (startIndex != null) {
            localVarQueryParams.addAll(localVarApiClient.parameterToPair("startIndex", startIndex));
        }

        if (count != null) {
            localVarQueryParams.addAll(localVarApiClient.parameterToPair("count", count));
        }

        if (stateFilter != null) {
            localVarQueryParams.addAll(localVarApiClient.parameterToPair("stateFilter", stateFilter));
        }

        if (campaignIdFilter != null) {
            localVarQueryParams.addAll(localVarApiClient.parameterToPair("campaignIdFilter", campaignIdFilter));
        }

        if (adGroupIdFilter != null) {
            localVarQueryParams.addAll(localVarApiClient.parameterToPair("adGroupIdFilter", adGroupIdFilter));
        }

        if (targetIdFilter != null) {
            localVarQueryParams.addAll(localVarApiClient.parameterToPair("targetIdFilter", targetIdFilter));
        }

        if (amazonAdvertisingAPIClientId != null) {
            localVarHeaderParams.put("Amazon-Advertising-API-ClientId", localVarApiClient.parameterToString(amazonAdvertisingAPIClientId));
        }

        if (amazonAdvertisingAPIScope != null) {
            localVarHeaderParams.put("Amazon-Advertising-API-Scope", localVarApiClient.parameterToString(amazonAdvertisingAPIScope));
        }

        final String[] localVarAccepts = {
            "application/json"
        };
        final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts);
        if (localVarAccept != null) {
            localVarHeaderParams.put("Accept", localVarAccept);
        }

        final String[] localVarContentTypes = {
            
        };
        final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
        localVarHeaderParams.put("Content-Type", localVarContentType);

        String[] localVarAuthNames = new String[] { "bearer" };
        return localVarApiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback);
    }

    @SuppressWarnings("rawtypes")
    private okhttp3.Call listNegativeTargetingClausesValidateBeforeCall(String amazonAdvertisingAPIClientId, String amazonAdvertisingAPIScope, BigDecimal startIndex, BigDecimal count, String stateFilter, String campaignIdFilter, String adGroupIdFilter, String targetIdFilter, final ApiCallback _callback) throws ApiException {
        
        // verify the required parameter 'amazonAdvertisingAPIClientId' is set
        if (amazonAdvertisingAPIClientId == null) {
            throw new ApiException("Missing the required parameter 'amazonAdvertisingAPIClientId' when calling listNegativeTargetingClauses(Async)");
        }
        
        // verify the required parameter 'amazonAdvertisingAPIScope' is set
        if (amazonAdvertisingAPIScope == null) {
            throw new ApiException("Missing the required parameter 'amazonAdvertisingAPIScope' when calling listNegativeTargetingClauses(Async)");
        }
        

        okhttp3.Call localVarCall = listNegativeTargetingClausesCall(amazonAdvertisingAPIClientId, amazonAdvertisingAPIScope, startIndex, count, stateFilter, campaignIdFilter, adGroupIdFilter, targetIdFilter, _callback);
        return localVarCall;

    }

    /**
     * Gets a list of negative targeting clauses filtered by specified criteria.
     * 
     * @param amazonAdvertisingAPIClientId The identifier of a client associated with a \&quot;Login with Amazon\&quot; developer account. (required)
     * @param amazonAdvertisingAPIScope The identifier of a profile associated with the advertiser account. Use &#x60;GET&#x60; method on Profiles resource to list profiles associated with the access token passed in the HTTP Authorization header. (required)
     * @param startIndex 0-indexed record offset for the result set. (optional, default to 0)
     * @param count Number of records to include in the paged response. Defaults to max page size. (optional)
     * @param stateFilter Restricts results to negative resources with state within the specified comma-separated list. Default includes all. (optional)
     * @param campaignIdFilter A comma-delimited list of campaign identifiers. (optional)
     * @param adGroupIdFilter Restricts results to keywords associated with ad groups specified by identifier in the comma-delimited list. (optional)
     * @param targetIdFilter A comma-delimited list of target identifiers. (optional)
     * @return List&lt;NegativeTargetingClause&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     * @http.response.details
     <table summary="Response Details" border="1">
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> Success. </td><td>  -  </td></tr>
        <tr><td> 404 </td><td> The requested resource was not found. </td><td>  -  </td></tr>
     </table>
     */
    public List<NegativeTargetingClause> listNegativeTargetingClauses(String amazonAdvertisingAPIClientId, String amazonAdvertisingAPIScope, BigDecimal startIndex, BigDecimal count, String stateFilter, String campaignIdFilter, String adGroupIdFilter, String targetIdFilter) throws ApiException {
        ApiResponse<List<NegativeTargetingClause>> localVarResp = listNegativeTargetingClausesWithHttpInfo(amazonAdvertisingAPIClientId, amazonAdvertisingAPIScope, startIndex, count, stateFilter, campaignIdFilter, adGroupIdFilter, targetIdFilter);
        return localVarResp.getData();
    }

    /**
     * Gets a list of negative targeting clauses filtered by specified criteria.
     * 
     * @param amazonAdvertisingAPIClientId The identifier of a client associated with a \&quot;Login with Amazon\&quot; developer account. (required)
     * @param amazonAdvertisingAPIScope The identifier of a profile associated with the advertiser account. Use &#x60;GET&#x60; method on Profiles resource to list profiles associated with the access token passed in the HTTP Authorization header. (required)
     * @param startIndex 0-indexed record offset for the result set. (optional, default to 0)
     * @param count Number of records to include in the paged response. Defaults to max page size. (optional)
     * @param stateFilter Restricts results to negative resources with state within the specified comma-separated list. Default includes all. (optional)
     * @param campaignIdFilter A comma-delimited list of campaign identifiers. (optional)
     * @param adGroupIdFilter Restricts results to keywords associated with ad groups specified by identifier in the comma-delimited list. (optional)
     * @param targetIdFilter A comma-delimited list of target identifiers. (optional)
     * @return ApiResponse&lt;List&lt;NegativeTargetingClause&gt;&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     * @http.response.details
     <table summary="Response Details" border="1">
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> Success. </td><td>  -  </td></tr>
        <tr><td> 404 </td><td> The requested resource was not found. </td><td>  -  </td></tr>
     </table>
     */
    public ApiResponse<List<NegativeTargetingClause>> listNegativeTargetingClausesWithHttpInfo(String amazonAdvertisingAPIClientId, String amazonAdvertisingAPIScope, BigDecimal startIndex, BigDecimal count, String stateFilter, String campaignIdFilter, String adGroupIdFilter, String targetIdFilter) throws ApiException {
        okhttp3.Call localVarCall = listNegativeTargetingClausesValidateBeforeCall(amazonAdvertisingAPIClientId, amazonAdvertisingAPIScope, startIndex, count, stateFilter, campaignIdFilter, adGroupIdFilter, targetIdFilter, null);
        Type localVarReturnType = new TypeToken<List<NegativeTargetingClause>>(){}.getType();
        return localVarApiClient.execute(localVarCall, localVarReturnType);
    }

    /**
     * Gets a list of negative targeting clauses filtered by specified criteria. (asynchronously)
     * 
     * @param amazonAdvertisingAPIClientId The identifier of a client associated with a \&quot;Login with Amazon\&quot; developer account. (required)
     * @param amazonAdvertisingAPIScope The identifier of a profile associated with the advertiser account. Use &#x60;GET&#x60; method on Profiles resource to list profiles associated with the access token passed in the HTTP Authorization header. (required)
     * @param startIndex 0-indexed record offset for the result set. (optional, default to 0)
     * @param count Number of records to include in the paged response. Defaults to max page size. (optional)
     * @param stateFilter Restricts results to negative resources with state within the specified comma-separated list. Default includes all. (optional)
     * @param campaignIdFilter A comma-delimited list of campaign identifiers. (optional)
     * @param adGroupIdFilter Restricts results to keywords associated with ad groups specified by identifier in the comma-delimited list. (optional)
     * @param targetIdFilter A comma-delimited list of target identifiers. (optional)
     * @param _callback The callback to be executed when the API call finishes
     * @return The request call
     * @throws ApiException If fail to process the API call, e.g. serializing the request body object
     * @http.response.details
     <table summary="Response Details" border="1">
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> Success. </td><td>  -  </td></tr>
        <tr><td> 404 </td><td> The requested resource was not found. </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call listNegativeTargetingClausesAsync(String amazonAdvertisingAPIClientId, String amazonAdvertisingAPIScope, BigDecimal startIndex, BigDecimal count, String stateFilter, String campaignIdFilter, String adGroupIdFilter, String targetIdFilter, final ApiCallback<List<NegativeTargetingClause>> _callback) throws ApiException {

        okhttp3.Call localVarCall = listNegativeTargetingClausesValidateBeforeCall(amazonAdvertisingAPIClientId, amazonAdvertisingAPIScope, startIndex, count, stateFilter, campaignIdFilter, adGroupIdFilter, targetIdFilter, _callback);
        Type localVarReturnType = new TypeToken<List<NegativeTargetingClause>>(){}.getType();
        localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
        return localVarCall;
    }
    /**
     * Build call for listNegativeTargetingClausesEx
     * @param amazonAdvertisingAPIClientId The identifier of a client associated with a \&quot;Login with Amazon\&quot; developer account. (required)
     * @param amazonAdvertisingAPIScope The identifier of a profile associated with the advertiser account. Use &#x60;GET&#x60; method on Profiles resource to list profiles associated with the access token passed in the HTTP Authorization header. (required)
     * @param startIndex 0-indexed record offset for the result set. (optional, default to 0)
     * @param count Number of records to include in the paged response. Defaults to max page size. (optional)
     * @param stateFilter Restricts results to negative resources with state within the specified comma-separated list. Default includes all. (optional)
     * @param campaignIdFilter A comma-delimited list of campaign identifiers. (optional)
     * @param adGroupIdFilter Restricts results to keywords associated with ad groups specified by identifier in the comma-delimited list. (optional)
     * @param targetIdFilter A comma-delimited list of target identifiers. (optional)
     * @param _callback Callback for upload/download progress
     * @return Call to execute
     * @throws ApiException If fail to serialize the request body object
     * @http.response.details
     <table summary="Response Details" border="1">
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> Success. </td><td>  -  </td></tr>
        <tr><td> 404 </td><td> The requested resource was not found. </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call listNegativeTargetingClausesExCall(String amazonAdvertisingAPIClientId, String amazonAdvertisingAPIScope, BigDecimal startIndex, BigDecimal count, String stateFilter, String campaignIdFilter, String adGroupIdFilter, String targetIdFilter, final ApiCallback _callback) throws ApiException {
        Object localVarPostBody = null;

        // create path and map variables
        String localVarPath = "/v2/sp/negativeTargets/extended";

        List<Pair> localVarQueryParams = new ArrayList<Pair>();
        List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
        Map<String, String> localVarHeaderParams = new HashMap<String, String>();
        Map<String, String> localVarCookieParams = new HashMap<String, String>();
        Map<String, Object> localVarFormParams = new HashMap<String, Object>();

        if (startIndex != null) {
            localVarQueryParams.addAll(localVarApiClient.parameterToPair("startIndex", startIndex));
        }

        if (count != null) {
            localVarQueryParams.addAll(localVarApiClient.parameterToPair("count", count));
        }

        if (stateFilter != null) {
            localVarQueryParams.addAll(localVarApiClient.parameterToPair("stateFilter", stateFilter));
        }

        if (campaignIdFilter != null) {
            localVarQueryParams.addAll(localVarApiClient.parameterToPair("campaignIdFilter", campaignIdFilter));
        }

        if (adGroupIdFilter != null) {
            localVarQueryParams.addAll(localVarApiClient.parameterToPair("adGroupIdFilter", adGroupIdFilter));
        }

        if (targetIdFilter != null) {
            localVarQueryParams.addAll(localVarApiClient.parameterToPair("targetIdFilter", targetIdFilter));
        }

        if (amazonAdvertisingAPIClientId != null) {
            localVarHeaderParams.put("Amazon-Advertising-API-ClientId", localVarApiClient.parameterToString(amazonAdvertisingAPIClientId));
        }

        if (amazonAdvertisingAPIScope != null) {
            localVarHeaderParams.put("Amazon-Advertising-API-Scope", localVarApiClient.parameterToString(amazonAdvertisingAPIScope));
        }

        final String[] localVarAccepts = {
            "application/json"
        };
        final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts);
        if (localVarAccept != null) {
            localVarHeaderParams.put("Accept", localVarAccept);
        }

        final String[] localVarContentTypes = {
            
        };
        final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
        localVarHeaderParams.put("Content-Type", localVarContentType);

        String[] localVarAuthNames = new String[] { "bearer" };
        return localVarApiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback);
    }

    @SuppressWarnings("rawtypes")
    private okhttp3.Call listNegativeTargetingClausesExValidateBeforeCall(String amazonAdvertisingAPIClientId, String amazonAdvertisingAPIScope, BigDecimal startIndex, BigDecimal count, String stateFilter, String campaignIdFilter, String adGroupIdFilter, String targetIdFilter, final ApiCallback _callback) throws ApiException {
        
        // verify the required parameter 'amazonAdvertisingAPIClientId' is set
        if (amazonAdvertisingAPIClientId == null) {
            throw new ApiException("Missing the required parameter 'amazonAdvertisingAPIClientId' when calling listNegativeTargetingClausesEx(Async)");
        }
        
        // verify the required parameter 'amazonAdvertisingAPIScope' is set
        if (amazonAdvertisingAPIScope == null) {
            throw new ApiException("Missing the required parameter 'amazonAdvertisingAPIScope' when calling listNegativeTargetingClausesEx(Async)");
        }
        

        okhttp3.Call localVarCall = listNegativeTargetingClausesExCall(amazonAdvertisingAPIClientId, amazonAdvertisingAPIScope, startIndex, count, stateFilter, campaignIdFilter, adGroupIdFilter, targetIdFilter, _callback);
        return localVarCall;

    }

    /**
     * Gets a list of negative targeting clauses filtered by specified criteria.
     * 
     * @param amazonAdvertisingAPIClientId The identifier of a client associated with a \&quot;Login with Amazon\&quot; developer account. (required)
     * @param amazonAdvertisingAPIScope The identifier of a profile associated with the advertiser account. Use &#x60;GET&#x60; method on Profiles resource to list profiles associated with the access token passed in the HTTP Authorization header. (required)
     * @param startIndex 0-indexed record offset for the result set. (optional, default to 0)
     * @param count Number of records to include in the paged response. Defaults to max page size. (optional)
     * @param stateFilter Restricts results to negative resources with state within the specified comma-separated list. Default includes all. (optional)
     * @param campaignIdFilter A comma-delimited list of campaign identifiers. (optional)
     * @param adGroupIdFilter Restricts results to keywords associated with ad groups specified by identifier in the comma-delimited list. (optional)
     * @param targetIdFilter A comma-delimited list of target identifiers. (optional)
     * @return List&lt;NegativeTargetingClauseEx&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     * @http.response.details
     <table summary="Response Details" border="1">
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> Success. </td><td>  -  </td></tr>
        <tr><td> 404 </td><td> The requested resource was not found. </td><td>  -  </td></tr>
     </table>
     */
    public List<NegativeTargetingClauseEx> listNegativeTargetingClausesEx(String amazonAdvertisingAPIClientId, String amazonAdvertisingAPIScope, BigDecimal startIndex, BigDecimal count, String stateFilter, String campaignIdFilter, String adGroupIdFilter, String targetIdFilter) throws ApiException {
        ApiResponse<List<NegativeTargetingClauseEx>> localVarResp = listNegativeTargetingClausesExWithHttpInfo(amazonAdvertisingAPIClientId, amazonAdvertisingAPIScope, startIndex, count, stateFilter, campaignIdFilter, adGroupIdFilter, targetIdFilter);
        return localVarResp.getData();
    }

    /**
     * Gets a list of negative targeting clauses filtered by specified criteria.
     * 
     * @param amazonAdvertisingAPIClientId The identifier of a client associated with a \&quot;Login with Amazon\&quot; developer account. (required)
     * @param amazonAdvertisingAPIScope The identifier of a profile associated with the advertiser account. Use &#x60;GET&#x60; method on Profiles resource to list profiles associated with the access token passed in the HTTP Authorization header. (required)
     * @param startIndex 0-indexed record offset for the result set. (optional, default to 0)
     * @param count Number of records to include in the paged response. Defaults to max page size. (optional)
     * @param stateFilter Restricts results to negative resources with state within the specified comma-separated list. Default includes all. (optional)
     * @param campaignIdFilter A comma-delimited list of campaign identifiers. (optional)
     * @param adGroupIdFilter Restricts results to keywords associated with ad groups specified by identifier in the comma-delimited list. (optional)
     * @param targetIdFilter A comma-delimited list of target identifiers. (optional)
     * @return ApiResponse&lt;List&lt;NegativeTargetingClauseEx&gt;&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     * @http.response.details
     <table summary="Response Details" border="1">
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> Success. </td><td>  -  </td></tr>
        <tr><td> 404 </td><td> The requested resource was not found. </td><td>  -  </td></tr>
     </table>
     */
    public ApiResponse<List<NegativeTargetingClauseEx>> listNegativeTargetingClausesExWithHttpInfo(String amazonAdvertisingAPIClientId, String amazonAdvertisingAPIScope, BigDecimal startIndex, BigDecimal count, String stateFilter, String campaignIdFilter, String adGroupIdFilter, String targetIdFilter) throws ApiException {
        okhttp3.Call localVarCall = listNegativeTargetingClausesExValidateBeforeCall(amazonAdvertisingAPIClientId, amazonAdvertisingAPIScope, startIndex, count, stateFilter, campaignIdFilter, adGroupIdFilter, targetIdFilter, null);
        Type localVarReturnType = new TypeToken<List<NegativeTargetingClauseEx>>(){}.getType();
        return localVarApiClient.execute(localVarCall, localVarReturnType);
    }

    /**
     * Gets a list of negative targeting clauses filtered by specified criteria. (asynchronously)
     * 
     * @param amazonAdvertisingAPIClientId The identifier of a client associated with a \&quot;Login with Amazon\&quot; developer account. (required)
     * @param amazonAdvertisingAPIScope The identifier of a profile associated with the advertiser account. Use &#x60;GET&#x60; method on Profiles resource to list profiles associated with the access token passed in the HTTP Authorization header. (required)
     * @param startIndex 0-indexed record offset for the result set. (optional, default to 0)
     * @param count Number of records to include in the paged response. Defaults to max page size. (optional)
     * @param stateFilter Restricts results to negative resources with state within the specified comma-separated list. Default includes all. (optional)
     * @param campaignIdFilter A comma-delimited list of campaign identifiers. (optional)
     * @param adGroupIdFilter Restricts results to keywords associated with ad groups specified by identifier in the comma-delimited list. (optional)
     * @param targetIdFilter A comma-delimited list of target identifiers. (optional)
     * @param _callback The callback to be executed when the API call finishes
     * @return The request call
     * @throws ApiException If fail to process the API call, e.g. serializing the request body object
     * @http.response.details
     <table summary="Response Details" border="1">
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> Success. </td><td>  -  </td></tr>
        <tr><td> 404 </td><td> The requested resource was not found. </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call listNegativeTargetingClausesExAsync(String amazonAdvertisingAPIClientId, String amazonAdvertisingAPIScope, BigDecimal startIndex, BigDecimal count, String stateFilter, String campaignIdFilter, String adGroupIdFilter, String targetIdFilter, final ApiCallback<List<NegativeTargetingClauseEx>> _callback) throws ApiException {

        okhttp3.Call localVarCall = listNegativeTargetingClausesExValidateBeforeCall(amazonAdvertisingAPIClientId, amazonAdvertisingAPIScope, startIndex, count, stateFilter, campaignIdFilter, adGroupIdFilter, targetIdFilter, _callback);
        Type localVarReturnType = new TypeToken<List<NegativeTargetingClauseEx>>(){}.getType();
        localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
        return localVarCall;
    }
    /**
     * Build call for updateNegativeTargetingClause
     * @param amazonAdvertisingAPIClientId The identifier of a client associated with a \&quot;Login with Amazon\&quot; developer account. (required)
     * @param amazonAdvertisingAPIScope The identifier of a profile associated with the advertiser account. Use &#x60;GET&#x60; method on Profiles resource to list profiles associated with the access token passed in the HTTP Authorization header. (required)
     * @param updateNegativeTargetingClause A list of negative targeting clauses with updated values. (optional)
     * @param _callback Callback for upload/download progress
     * @return Call to execute
     * @throws ApiException If fail to serialize the request body object
     * @http.response.details
     <table summary="Response Details" border="1">
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> Success. </td><td>  -  </td></tr>
        <tr><td> 401 </td><td> Unauthorized. </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call updateNegativeTargetingClauseCall(String amazonAdvertisingAPIClientId, String amazonAdvertisingAPIScope, List<UpdateNegativeTargetingClause> updateNegativeTargetingClause, final ApiCallback _callback) throws ApiException {
        Object localVarPostBody = updateNegativeTargetingClause;

        // create path and map variables
        String localVarPath = "/v2/sp/negativeTargets";

        List<Pair> localVarQueryParams = new ArrayList<Pair>();
        List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
        Map<String, String> localVarHeaderParams = new HashMap<String, String>();
        Map<String, String> localVarCookieParams = new HashMap<String, String>();
        Map<String, Object> localVarFormParams = new HashMap<String, Object>();

        if (amazonAdvertisingAPIClientId != null) {
            localVarHeaderParams.put("Amazon-Advertising-API-ClientId", localVarApiClient.parameterToString(amazonAdvertisingAPIClientId));
        }

        if (amazonAdvertisingAPIScope != null) {
            localVarHeaderParams.put("Amazon-Advertising-API-Scope", localVarApiClient.parameterToString(amazonAdvertisingAPIScope));
        }

        final String[] localVarAccepts = {
            "application/json"
        };
        final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts);
        if (localVarAccept != null) {
            localVarHeaderParams.put("Accept", localVarAccept);
        }

        final String[] localVarContentTypes = {
            "application/json"
        };
        final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
        localVarHeaderParams.put("Content-Type", localVarContentType);

        String[] localVarAuthNames = new String[] { "bearer" };
        return localVarApiClient.buildCall(localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback);
    }

    @SuppressWarnings("rawtypes")
    private okhttp3.Call updateNegativeTargetingClauseValidateBeforeCall(String amazonAdvertisingAPIClientId, String amazonAdvertisingAPIScope, List<UpdateNegativeTargetingClause> updateNegativeTargetingClause, final ApiCallback _callback) throws ApiException {
        
        // verify the required parameter 'amazonAdvertisingAPIClientId' is set
        if (amazonAdvertisingAPIClientId == null) {
            throw new ApiException("Missing the required parameter 'amazonAdvertisingAPIClientId' when calling updateNegativeTargetingClause(Async)");
        }
        
        // verify the required parameter 'amazonAdvertisingAPIScope' is set
        if (amazonAdvertisingAPIScope == null) {
            throw new ApiException("Missing the required parameter 'amazonAdvertisingAPIScope' when calling updateNegativeTargetingClause(Async)");
        }
        

        okhttp3.Call localVarCall = updateNegativeTargetingClauseCall(amazonAdvertisingAPIClientId, amazonAdvertisingAPIScope, updateNegativeTargetingClause, _callback);
        return localVarCall;

    }

    /**
     * Updates one or more negative targeting clauses.
     * 
     * @param amazonAdvertisingAPIClientId The identifier of a client associated with a \&quot;Login with Amazon\&quot; developer account. (required)
     * @param amazonAdvertisingAPIScope The identifier of a profile associated with the advertiser account. Use &#x60;GET&#x60; method on Profiles resource to list profiles associated with the access token passed in the HTTP Authorization header. (required)
     * @param updateNegativeTargetingClause A list of negative targeting clauses with updated values. (optional)
     * @return List&lt;NegativeTargetingClauseResponse&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     * @http.response.details
     <table summary="Response Details" border="1">
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> Success. </td><td>  -  </td></tr>
        <tr><td> 401 </td><td> Unauthorized. </td><td>  -  </td></tr>
     </table>
     */
    public List<NegativeTargetingClauseResponse> updateNegativeTargetingClause(String amazonAdvertisingAPIClientId, String amazonAdvertisingAPIScope, List<UpdateNegativeTargetingClause> updateNegativeTargetingClause) throws ApiException {
        ApiResponse<List<NegativeTargetingClauseResponse>> localVarResp = updateNegativeTargetingClauseWithHttpInfo(amazonAdvertisingAPIClientId, amazonAdvertisingAPIScope, updateNegativeTargetingClause);
        return localVarResp.getData();
    }

    /**
     * Updates one or more negative targeting clauses.
     * 
     * @param amazonAdvertisingAPIClientId The identifier of a client associated with a \&quot;Login with Amazon\&quot; developer account. (required)
     * @param amazonAdvertisingAPIScope The identifier of a profile associated with the advertiser account. Use &#x60;GET&#x60; method on Profiles resource to list profiles associated with the access token passed in the HTTP Authorization header. (required)
     * @param updateNegativeTargetingClause A list of negative targeting clauses with updated values. (optional)
     * @return ApiResponse&lt;List&lt;NegativeTargetingClauseResponse&gt;&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     * @http.response.details
     <table summary="Response Details" border="1">
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> Success. </td><td>  -  </td></tr>
        <tr><td> 401 </td><td> Unauthorized. </td><td>  -  </td></tr>
     </table>
     */
    public ApiResponse<List<NegativeTargetingClauseResponse>> updateNegativeTargetingClauseWithHttpInfo(String amazonAdvertisingAPIClientId, String amazonAdvertisingAPIScope, List<UpdateNegativeTargetingClause> updateNegativeTargetingClause) throws ApiException {
        okhttp3.Call localVarCall = updateNegativeTargetingClauseValidateBeforeCall(amazonAdvertisingAPIClientId, amazonAdvertisingAPIScope, updateNegativeTargetingClause, null);
        Type localVarReturnType = new TypeToken<List<NegativeTargetingClauseResponse>>(){}.getType();
        return localVarApiClient.execute(localVarCall, localVarReturnType);
    }

    /**
     * Updates one or more negative targeting clauses. (asynchronously)
     * 
     * @param amazonAdvertisingAPIClientId The identifier of a client associated with a \&quot;Login with Amazon\&quot; developer account. (required)
     * @param amazonAdvertisingAPIScope The identifier of a profile associated with the advertiser account. Use &#x60;GET&#x60; method on Profiles resource to list profiles associated with the access token passed in the HTTP Authorization header. (required)
     * @param updateNegativeTargetingClause A list of negative targeting clauses with updated values. (optional)
     * @param _callback The callback to be executed when the API call finishes
     * @return The request call
     * @throws ApiException If fail to process the API call, e.g. serializing the request body object
     * @http.response.details
     <table summary="Response Details" border="1">
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> Success. </td><td>  -  </td></tr>
        <tr><td> 401 </td><td> Unauthorized. </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call updateNegativeTargetingClauseAsync(String amazonAdvertisingAPIClientId, String amazonAdvertisingAPIScope, List<UpdateNegativeTargetingClause> updateNegativeTargetingClause, final ApiCallback<List<NegativeTargetingClauseResponse>> _callback) throws ApiException {

        okhttp3.Call localVarCall = updateNegativeTargetingClauseValidateBeforeCall(amazonAdvertisingAPIClientId, amazonAdvertisingAPIScope, updateNegativeTargetingClause, _callback);
        Type localVarReturnType = new TypeToken<List<NegativeTargetingClauseResponse>>(){}.getType();
        localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
        return localVarCall;
    }
}
